package cn.iocoder.yudao.module.brokerage.user.controller.app;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.brokerage.user.pojo.vo.AppBrokerageUserVO;
import cn.iocoder.yudao.module.brokerage.user.service.AppBrokerageUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;

@Tag(name = "用户 App - 招商团队")
@RestController
@RequestMapping("/brokerage/user")
@Validated
public class AppBrokerageAgencyController {

    @Resource
    private AppBrokerageUserService appBrokerageUserService;

    @GetMapping("/page-agency")
    @Operation(summary = "获得我的招商团队分页")
    @Parameter(name = "pageNo", description = "页码", required = true, example = "1")
    @Parameter(name = "pageSize", description = "每页数据条数", required = true, example = "10")
    public CommonResult<PageResult<AppBrokerageUserVO>> getAgencyTeamPage(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
        return success(appBrokerageUserService.getAgencyTeamPage(pageNo, pageSize, getLoginUserId()));
    }

}